package cn.xpg.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.xpg.dao.RepertoryMapper;
import cn.xpg.entity.Repertory;
import cn.xpg.service.RepertoryService;

@Service("repertoryService")
public class RepertoryServiceImpl implements RepertoryService {

	@Resource(name = "repertoryMapper")
	private RepertoryMapper repertoryMapper;

	@Override
	public int addRepertory(Repertory repertory) {
		// TODO Auto-generated method stub
		int count = repertoryMapper.addRepertory(repertory);
		return count;
	}

	@Override
	public int deleteRepertory(int repertory_id) {
		// TODO Auto-generated method stub
		int count = repertoryMapper.deleteRepertory(repertory_id);
		return count;
	}

	@Override
	public List<Repertory> getRepertoryList(String product_name, int currentPageNo, int pageSize) {
		// TODO Auto-generated method stub
		List<Repertory> list = repertoryMapper.getRepertoryList(product_name, currentPageNo, pageSize);
		return list;
	}

	@Override
	public int getRepertoryCount(String product_name) {
		// TODO Auto-generated method stub
		int count = Integer.valueOf(repertoryMapper.getRepertoryCount(product_name).toString());
		return count;
	}

	@Override
	public Repertory getRepertoryId(int repertory_id) {
		// TODO Auto-generated method stub
		Repertory repertory = repertoryMapper.getRepertoryId(repertory_id);
		return repertory;
	}

	@Override
	public int updateRepertory(Repertory repertory) {
		// TODO Auto-generated method stub
		int count = repertoryMapper.updateRepertory(repertory);
		return count;
	}

	@Override
	public List<Repertory> getRepertoryListBySname(String store_name, int currentPageNo, int pageSiz) {
		// TODO Auto-generated method stub
		List<Repertory> list = repertoryMapper.getRepertoryListBySname(store_name, currentPageNo, pageSiz);
		return list;
	}

	@Override
	public int getRepertoryCountBySname(String store_name) {
		// TODO Auto-generated method stub
		int count = Integer.valueOf(repertoryMapper.getRepertoryCountBySname(store_name).toString());
		return count;
	}
}
